package Thread;

import java.util.Scanner;

//线程的中段，进行使用标志位来控制线程的中段；
public class Demo9 {
    private static  boolean flg=true;
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            while (flg) {
                System.out.println("进行让小笨茜执行线程");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("让小笨茜结束线程");
        });
        t.start();//开始启动小笨茜线程；

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入内容，让线程t结束");
        scanner.next();
        flg=false;
    }
}
